package org.rambadger.command.representation;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.mongojack.Id;
import org.mongojack.MongoCollection;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.NotNull;


@MongoCollection(name = "users")
public class User {
    @Id @UrlIdentifier @NotNull
    @JsonProperty String username;

    @Email @NotBlank
    @JsonProperty String emailAddress;

    @Length(max = 32) @NotNull
    @JsonProperty String firstName;

    @Length(max = 32) @NotNull
    @JsonProperty String lastName;

    @JsonProperty int submissionPoints;
    @JsonProperty int reviewPoints;

    User() {}

    public User(String username, String emailAddress, String firstName, String lastName) {
        this.username = username;
        this.emailAddress = emailAddress;
        this.firstName = firstName;
        this.lastName = lastName;
        this.submissionPoints = 0;
        this.reviewPoints = 0;
    }

    public String getUsername() {
        return username;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public int getSubmissionPoints() {
        return submissionPoints;
    }

    public void setSubmissionPoints(int submissionPoints) {
        this.submissionPoints = submissionPoints;
    }

    public int getReviewPoints() {
        return reviewPoints;
    }

    public void setReviewPoints(int reviewPoints) {
        this.reviewPoints = reviewPoints;
    }
}
